'\" te
.\" Copyright (C) 2003, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright (C) 2020, Sergio Aguayo. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH GETIPSECPROTOBYNAME 3NSL "February 21, 2023"
.SH NAME
getipsecprotobyname, getipsecprotobynum \- query IPsec protocols entries
.SH SYNOPSIS
.nf
\fBcc \fR\fB-flag \&.\|.\|.\fR  \fIfile \fR\&.\|.\|.\fB-l\fRnsl [\fB -library \&.\|.\|. \fR]
#include <netdb.h>


\fBint\fR \fBgetipsecprotobyname\fR(\fBconst char *\fR\fIproto_name\fR);
.fi

.LP
.nf
\fBchar *\fR\fBgetipsecprotobynum\fR(\fBint\fR \fIproto_num\fR);
.fi

.SH DESCRIPTION
Use the \fBgetipsecprotobyname()\fR and \fBgetipsecprotobynum()\fR functions to
obtain the IPsec algorithm mappings that are defined by \fBipsecalgs\fR(8).
You can also use the \fBgetipsecprotobyname()\fR and \fBgetipsecprotobynum()\fR
functions in conjunction with \fBgetipsecalgbyname\fR(3NSL) and
\fBgetipsecalgbynum\fR(3NSL) to obtain information about the supported IPsec
algorithms. The IPsec algorithms and associated protocol name spaces are
defined by \fIRFC 2407\fR.
.sp
.LP
\fBgetipsecprotobyname()\fR takes as an argument the name of an IPsec protocol
and returns its assigned protocol number. The character string returned by the
\fBgetipsecprotobyname()\fR function must be freed by the called when it is no
longer needed.
.sp
.LP
\fBgetipsecprotobynum()\fR takes as an argument a protocol number and returns
the corresponding protocol name.
.sp
.LP
The following protocol numbers are pre-defined:
.sp
.ne 2
.na
\fB\fBIPSEC_PROTO_ESP\fR\fR
.ad
.RS 19n
Defines the encryption algorithms (transforms) that can be used by IPsec to
provide data confidentiality.
.RE

.sp
.ne 2
.na
\fB\fBIPSEC_PROTO_AH\fR\fR
.ad
.RS 19n
Defines the authentication algorithms (transforms) that can be used by IPsec to
provide authentication.
.RE

.SH PARAMETERS
.ne 2
.na
\fB\fIproto_name\fR\fR
.ad
.RS 14n
A pointer to the name of an IPsec protocol.
.RE

.sp
.ne 2
.na
\fB\fIproto_num\fR\fR
.ad
.RS 14n
A pointer to a protocol number.
.RE

.SH RETURN VALUES
The \fBgetipsecprotobyname()\fR function returns a protocol number upon
success, or \fB-1\fR if the protocol specified does not exist.
.sp
.LP
The \fBgetipsecprotobynum()\fR function returns a protocol name upon success,
or the \fINULL\fR value if the protocol number specified does not exist.
.SH ATTRIBUTES
See \fBattributes\fR(7)  for descriptions of the following attributes:
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
MT Level	MT Safe
_
Interface Stability	Evolving
.TE

.SH SEE ALSO
.BR getipsecalgbyname (3NSL),
.BR attributes (7),
.BR ipsecalgs (8)
.sp
.LP
Piper, D. \fIRFC 2407, The Internet IP Security Domain of Interpretation for
ISAKMP\fR. Network Working Group. November, 1998.
